<?php
/*
 * Model/Event.php
 * CakePHP Full Calendar Plugin
 *
 * Copyright (c) 2010 Silas Montgomery
 * http://silasmontgomery.com
 *
 * Licensed under MIT
 * http://www.opensource.org/licenses/mit-license.php
 */
 
class Elvi extends AppModel {
    var $name = 'Elvi';
    var $useTable = "elvis";
    
    public function find_customer($customer_number,$card_number) {
        return $this->find('first',array('conditions'=>array('customer_number'=>$customer_number,'card_number'=>$card_number)));
    }
    public function find_all_customer($customer_number,$card_number) {
        return $this->find('all',array('conditions'=>array('is_read'=>0,'customer_number'=>$customer_number,'card_number'=>$card_number)));
    }
    public function set_as_read($customer_number,$card_number) {
        $sql = "Update {$this->useTable} set is_read=1 where customer_number=$customer_number AND card_number=$card_number";
        return $this->query($sql);
    }
}